package com.youyiwen.Mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.youyiwen.Bean.Notice;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @Author: zhaoyang
 * @Date: 2021/04/06
 */
@Mapper
public interface NoticeMapper extends BaseMapper<Notice> {

    @Insert("insert into notice values (#{id},#{title},#{content},#{questionUrl},#{type},#{userName},#{hasRead},#{gmtCreate},#{parentId})")
    public void insertNotice(Notice notice);

    public List<Notice> selectNotice(String userName);

    @Delete("delete from notice where id = #{id}")
    public void deleteNotice(String id);

    @Update("update notice set hasRead = 1 where id = #{id}")
    public void updateRead(String id);

    @Select("select count(1) from notice where userName = #{userName} and hasRead = 0")
    public Integer selectMsgCount(String userName);
}
